/*
 * Copyright (C) 2009 Kristopher T Babic
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of
 * the GNU General Public License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, see <http://www.gnu.org/licenses>.
 */

package edu.idp.client.event;

import edu.idp.client.anim.AnimationParameter;
import edu.idp.shared.StoredObject;

import java.util.EventObject;

/**
 * An AnimationEvent is used to pass animation information between different
 * modules.  This information is used in the creation of animation objects,
 * animation paths and other animation related objects.
 *
 * @author Kristopher T. Babic
 * @version 1.0, Apr 29 2000
 */
public class AnimationEvent extends EventObject {

    private int type;                 // object type information is to be used for
    private java.awt.Point path = null;    // depreciated, used to be used for straight paths
    private java.awt.Point loc = null;    // starting location of animated object
    private edu.idp.client.anim.sequence.Sequence sequence = null;      // image sequence for the animated object
    private java.lang.String seqName = null;    // full name of the image sequence
    private AnimationParameter seqParams = null;    // parameters needed by the image sequence
    private AnimationParameter ap = null;            // depreciated? same as above?
    private edu.idp.client.anim.AnimationPath animPath = null;    // AnimationPath used by the animated object to be created
    private long lifeSpan = StoredObject.DEFAULT_DEATH;

    /**
     * initializes the AnimationEvent object with the specified object and type
     */
    public AnimationEvent(Object o, int type) {
        super(o);
        this.type = type;
    }

    /**
     * stores the lifespan of the animated object whose information is being passed by the event
     *
     * @param time the long value of the timespan
     */
    public void setLifeSpan(long time) {
        this.lifeSpan = time;
    }

    /**
     * returns the lifespan of the animated object whose information is being passed
     * by the event
     *
     * @return long value representing the lifespan of the animated object
     */
    public long getLifeSpan() {
        return this.lifeSpan;
    }

    /**
     * returns the type of animated object or animated related object that the information
     * in this event is being used for
     *
     * @return an integer value that represents the type
     */
    public int getType() {
        return this.type;
    }

    /**
     * returns the line path that is used by the animated object
     *
     * @deprecated this method is not used any more as the paths of the animated
     *             object are controlled by AnimatedPath objects and not by the animated object itself
     */
    public java.awt.Point getPath() {
        return this.path;
    }

    /**
     * returns the starting location for the animated object or animated related object.
     * This isn't the most reliable information since this information is already contained
     * within the AnimatedPath itself.
     *
     * @return a Point object that contains the x and y values for the starting location
     */
    public java.awt.Point getLocation() {
        return this.loc;
    }

    /**
     * Used to return the full class name of the sequence to be used by the animated object
     *
     * @return a string representation of the image Sequence. ie. "<i>java.awt.Point</i>"
     */
    public java.lang.String getSequenceName() {
        return seqName;
    }

    /**
     * returns an AnimationParameter object that contains all the parameters needed to
     * recreate the image Sequence needed by the animated object
     *
     * @return an AnimationParameter that contains parameters for an image Sequence object
     */
    public AnimationParameter getSequenceParameters() {
        return seqParams;
    }

    /**
     * returns the animation parameters needed to recreate an image Sequence
     *
     * @deprecated it appears that this method was a precursor to getSequenceParameters.  If not,
     *             then it is relatively similar
     */
    public AnimationParameter getParameters() {
        return this.ap;
    }

    /**
     * Returns the actual sequence object that is used by the animated object for image animation
     */
    public edu.idp.client.anim.sequence.Sequence getSequence() {
        return this.sequence;
    }

    /**
     * returns the AnimationPath object that is used to create the animated object's path
     */
    public edu.idp.client.anim.AnimationPath getAnimationPath() {
        return this.animPath;
    }

    /**
     * stores the animation Sequence that is used by the animated object for image animation
     */
    public void setSequence(edu.idp.client.anim.sequence.Sequence s) {
        this.sequence = s;
    }

    /**
     * stores the type of animation object this even is storing data about
     */
    public void setType(int type) {
        this.type = type;
    }

    /**
     * stores a line path that is used for an animated object
     *
     * @deprecated AnimationPaths are now used to control the movement of animated objects, so
     *             the storing of a line path is no longer needed.
     */
    public void setPath(java.awt.Point p) {
        this.path = p;
    }

    /**
     * This method stores the location of the starting screen location for the animated object
     *
     * @param p contains the x and y coordinates of the starting location of the animated object
     */
    public void setLocation(java.awt.Point p) {
        this.loc = p;
    }

    /**
     * stores the full name of the image Sequence to be used by the animated object
     *
     * @param s the string representation of the full name of the Sequence object. ie. "<i>java.awt.Point</i>"
     */
    public void setSequenceName(java.lang.String s) {
        this.seqName = s;
    }

    /**
     * stores the parameters required to recreate the Sequence object that will be used
     * by the animated object this event for which this event hold information.
     *
     * @param ap an AnimationParameter that contains parameters for an image Sequence object
     */
    public void setSequenceParameters(AnimationParameter ap) {
        this.seqParams = ap;
    }

    /**
     * stores the parameters required to recreate the Sequence object that will be used
     * by the animated object this event for which this event hold information.
     *
     * @param ap an AnimationParameter that contains parameters for an image Sequence object
     * @deprecated this method seems to be a precursor for setSequenceParameters, if not it performs
     *             a very similar operation
     */
    public void setParameters(AnimationParameter ap) {
        this.ap = ap;
    }

    /**
     * stores the AnimationPath used to control the path of the animated object.
     *
     * @param ap an AnimationPath object that will be used by the animated object to control its movements
     */
    public void setAnimationPath(edu.idp.client.anim.AnimationPath ap) {
        this.animPath = ap;
    }

}
